package com.company.project.util;

import com.company.project.common.utils.DataResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

@Slf4j
@Component
public class TransactionHandler {

    /**
     * 导入
     *
     * @param file
     * @return
     */
    public DataResult importExcel(MultipartFile file) {
        System.out.println("[TransactionHandler] <importExcel>, importData.....11111111111111111111111");
        try {

            InputStream inputStream = file.getInputStream();
            log.info("============fileName=============="+file.getOriginalFilename());
//            List list = ExcelUtil.readExcel(inputStream, file.getOriginalFilename());
//            for (int i = 0; i < list.size(); i++) {
//                Object object = list.get(i);
//                log.info("============object=============="+object.toString());
//            }
            inputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return DataResult.success();
    }
}
